package hibernate;

import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;

public class ManagerController {
	@FXML
	private TextField s_ID;
	@FXML
	private TextField s_name;
	@FXML
	private TextField t_ID;
	@FXML
	private TextField t_name;
	
	@FXML
	private Button s_add_btn;
	@FXML
	private Button s_delete_btn;
	@FXML
	private Button t_add_btn;
	@FXML
	private Button t_delete_btn;
	
	DbsOperation op = new DbsOperation();
	
	@FXML	
	private void s_add_click() {

		String name = s_name.getText();
		Student student = new Student();
		student.setName(name);
		op.AddStudent(student);
		
	}
	@FXML	
	private void s_delete_click() {
		Integer ID = Integer.parseInt(s_ID.getText());
		Student student = new Student();
		student.setS_ID(ID);
		op.DeleteStudent(student);
		
	}

	
	@FXML	
	private void t_add_click() {
		String name = t_name.getText();
		Teacher teacher = new Teacher();
		teacher.setName(name);
		op.AddTeacher(teacher);
	}
	@FXML	
	private void t_delete_click() {
		Integer ID = Integer.parseInt(t_ID.getText());
		Teacher teacher = new Teacher();
		teacher.setT_ID(ID);
		op.DeleteTeacher(teacher);
		
	}

}
